<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/head.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><html:text name="sys.name" /></title>
</head>
<body>
<form id="listDataForm" method="post"
	action="<%=WEBPATH%>/article/index.crm" >
<table width="100%">
<tr>
		<td><html:text name="article.title"></html:text></td>
		<td><html:textfield id="publicinfo.articleTitle"
			name="publicinfo.articleTitle"></html:textfield></td>
		<td><html:text name="article.type"></html:text></td>
		<td><html:textfield id="publicinfo.articleType"
			name="publicinfo.articleType"></html:textfield></td>
</tr>
<tr>
		<td><html:text name="entity.startDate"></html:text></td>
		<td><html:date id="birthDay" name="publicinfo.startDate" format="yyyy-MM-dd"/><html:textfield id="publicinfo.startDate" name="publicinfo.startDate" value="%{birthDay}" readonly="true"/>&nbsp;<img style="border:0px;" src="<%=WEBPATH%>/images/calendar.gif" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:'publicinfo.startDate'})"></td>
		<td><html:text name="entity.startDate"></html:text></td>
		<td><html:date id="birthDay" name="publicinfo.endDate" format="yyyy-MM-dd"/><html:textfield id="publicinfo.endDate" name="publicinfo.endDate" value="%{birthDay}" readonly="true"/>&nbsp;<img style="border:0px;" src="<%=WEBPATH%>/images/calendar.gif" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:'publicinfo.endDate'})"></td>
</tr>
<tr>
	<td align="right">&nbsp;</td>
	<td  colspan="3">
	<input type="submit" value="<html:text name="button.query"/>">&nbsp;&nbsp;
	<input type="button" id="new" name="new" onclick="javascript:newFunction();" value="<html:text name="button.new"/>">&nbsp;&nbsp;
	<input type="button" id="delete" name="delete" onclick="javascript:deleteFunction();" value="<html:text name="button.delete"/>">&nbsp;&nbsp;
	<input type="button" id="edit" name="edit" onclick="javascript:editFunction();" value="<html:text name="button.modify"/>">&nbsp;&nbsp;
	<input type="button" id="view" name="view" onclick="javascript:viewFunction();" value="<html:text name="button.view"/>">
	</td>
</tr> 
</table>
<script type="text/javascript">
	function newFunction(){
		window.location="<%=WEBPATH%>/article/create.crm";
	}
	function deleteFunction(){
		CustomerAction.dwrDelete("",callFunction);
	}
	function callFunction(data){
		if(data=="success"){
			alert("<html:text name="entity.deleted"/>");
		}else{ 
			alert("<html:text name="entity.deleted.error"/>");
		}
	}
	function editFunction(){
		if(!checkSelectData()){
			
			window.location="<%=WEBPATH%>/article/edit.crm?id="+id;
		}else{
			alert("please choose data.");
		}
	}
	function viewFunction(){
		window.location="<%=WEBPATH%>/article/view.crm?id="+id;
	}
</script>
<table class="datatable">
	<thead>
		<tr>
			<td align="left" width="80"><input type="checkbox" id="checkList" onclick="javascript:onSelectChange(this);"><html:text
				name="entity.choose" /></td>
			<td width="200" align="left"><html:text name="article.title" /></td>
			<td width="100" align="left"><html:text name="article.user" /></td>
			<td width="100" align="left"><html:text name="article.type" /></td>
			<td width="100" align="left"><html:text name="article.publish" /></td> 
		</tr>
	</thead>
	<html:if test="publicinfoPages.result==null">
		<tbody>
			<tr>
				<td colspan="5"><html:text name="global.page.emptyMsg" /></td>
			</tr>
		</tbody>
		<script type="text/javascript">
			jQuery("#delete").hide();
			jQuery("#edit").hide();
			jQuery("#view").hide(); 
		</script>
	</html:if>
	<html:else>
		<html:iterator id="users" value="publicinfoPages.result"
			status="index">
			<tbody>
				<tr <html:if test="#index.odd">class="row_odd"</html:if>
					<html:else>class="row_even"</html:else>>
					<td align="left"><input type="checkbox" id="selectCheck" name="selectCheck"
						value="<html:property value="id"/>"></input></td>
					<td align="left"><html:property value="articleTitle" /></td>
					<td align="left"><html:property value="createUserId" /></td>
					<td align="left"><html:property value="articleType" /></td>
					<td align="left"><html:property value="publishDatetime" /></td> 
				</tr>
			</tbody>
		</html:iterator>
		<tr>
			<td colspan="6">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="6" align="right" valign="middle">
			<script type="text/javascript"> 
				messages=new Array();
				messages[0]="<html:text name="global.page.first" />";
				messages[1]="<html:text name="global.page.prev" />";
				messages[2]="<html:text name="global.page.next" />";
				messages[3]="<html:text name="global.page.last" />";
				messages[4]="<html:text name="global.page.page" />";
				messages[5]="<html:text name="global.page.everyPage" />";
				writePage(messages,"<%=WEBPATH%>","<html:property value="page"/>","<html:property value="publicinfoPages.totalPages"/>","<html:property value="pageSize"/>");
			</script>
			</td>
		</tr>
	</html:else>
</table>
</form>
</body>
</html>